package stu.aistar.mapper;

import org.apache.ibatis.annotations.*;
import stu.aistar.model.pojo.Movie;

import java.util.List;

@Mapper
public interface MovieMapper {

    @Select("select *from movie order by state desc")
    List<Movie> findAll();

    @Update("update movie set state = 0 where id = #{id} ")
    Integer delMoiveById(@Param("id")Integer id);

    @Update("update movie set state = 1 where id = #{id}")
    Integer showMovieById(@Param("id") Integer id);

    Integer delMoviesByIds(List<Integer> ids);

    Integer showMoviesByIds(List<Integer> ids);

    List<Movie> searchMovies(Movie movie);

    Integer insertMovie(Movie movie);

    @Select("select *from movie where name = #{name}")
    Movie findByName(@Param("name") String name);


    Integer updateMovieById(Movie movie);
}
